package com.blrs.service.project.backandforth.impl;

import java.util.List;

import com.blrs.common.utils.SecurityUtils;
import com.blrs.common.utils.uuid.IdUtils;
import com.blrs.service.project.backandforth.IBackAndForthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.blrs.mapper.BackAndForthMapper;
import com.blrs.domain.BackAndForth;

/**
 * 往来管理Service业务层处理
 * 
 * @author yuxiang.chen
 * @date 2023-08-03
 */
@Service
public class BackAndForthServiceImpl implements IBackAndForthService
{
    @Autowired
    private BackAndForthMapper backAndForthMapper;

    /**
     * 查询往来管理
     * 
     * @param id 往来管理主键
     * @return 往来管理
     */
    @Override
    public BackAndForth selectBackAndForthById(String id)
    {
        return backAndForthMapper.selectBackAndForthById(id);
    }

    /**
     * 查询往来管理列表
     * 
     * @param backAndForth 往来管理
     * @return 往来管理
     */
    @Override
    public List<BackAndForth> selectBackAndForthList(BackAndForth backAndForth)
    {
        return backAndForthMapper.selectBackAndForthList(backAndForth);
    }

    /**
     * 新增往来管理
     * 
     * @param backAndForth 往来管理
     * @return 结果
     */
    @Override
    public int insertBackAndForth(BackAndForth backAndForth)
    {
        backAndForth.setDelFlag("0");
        backAndForth.setId(IdUtils.fastUUID());
        backAndForth.setDepartmentName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
        backAndForth.setOrganizationId(SecurityUtils.getOrgId());
        backAndForth.setOrganizationName(SecurityUtils.getOrgName());
        backAndForth.setOperateId(SecurityUtils.getUserId());
        return backAndForthMapper.insertBackAndForth(backAndForth);
    }

    /**
     * 修改往来管理
     * 
     * @param backAndForth 往来管理
     * @return 结果
     */
    @Override
    public int updateBackAndForth(BackAndForth backAndForth)
    {
        return backAndForthMapper.updateBackAndForth(backAndForth);
    }

    /**
     * 批量删除往来管理
     * 
     * @param ids 需要删除的往来管理主键
     * @return 结果
     */
    @Override
    public int deleteBackAndForthByIds(String[] ids)
    {
        return backAndForthMapper.deleteBackAndForthByIds(ids);
    }

    /**
     * 删除往来管理信息
     * 
     * @param id 往来管理主键
     * @return 结果
     */
    @Override
    public int deleteBackAndForthById(String id)
    {
        return backAndForthMapper.deleteBackAndForthById(id);
    }
}
